<!--************************************************************************************************-->
<!-- < mainPage.php >                                                                               -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder : Yijing Chen                                                                          -->
<!-- Stu : 10389144                                                                                 -->
<!-- Modifier: Xiaofen Huang                                                                          -->
<!-- Stu : 10389169                                                                                 -->
<!-- Destription : 修改CSS样式          -->
<!-- Modifier: Xiaoxin Mo                                                                           -->
<!-- Stu : 10389159                                                                                 -->
<!-- Date: 2012-12-23                                                                               -->
<!-- Destription : 修改搜索表单内容           -->
<!--                                                                                        -->
<!-- Version : 2.1                                                                                  -->
<!--************************************************************************************************-->


<!DOCTYPE html>

<?php

	include_once("header.php");
	//include_once("bottom.php");
?>
<html lang="zh-hk">
<head>
	<title>Tiny bOOk</title>
	
	<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
	<meta name="contentType" value="text/html  charset=GBK">
	<meta name="description" content="在这里你可以看到最新发布的书籍，和好友共享对某本书的评论和笔记">
	<meta http-equiv="imagetoolbar" content="no">	
	<link rel="stylesheet" type="text/css" href="../css/mainPage.css">
	
	<?php
		include_once("../manager/UserManager.php");
		include_once("../manager/BookManager.php");
		include_once("../manager/ThesisManager.php");
		include_once("../manager/GroupManager.php");
		include_once("../manager/DescriptionManager.php");
		
		//=================added by xiaoxin
		$book_images = BookManager::getInstance()->getBookImages(5);
		$book_names = BookManager::getInstance()->getBooknames(BookManager::getInstance()->getBooklist(5));
		$thesis_names = ThesisManager::getInstance()->getThesisNames(8);
		$group_list = GroupManager::getInstance()->getGrouplist(5);
		$book_description_list = DescriptionManager::getInstance()->getContentlist("book",9);
		$thesis_description_list = DescriptionManager::getInstance()->getContentlist("thesis",9);
	?>
</head>

<body>
	<div id="main">
		<div id="conta">
		<div id="right">
			<!--搜索框 added by Xiaofen Huang-->
			<div id="search_block">
				<div id="search_wrap">
					<span id="new_search_block"></span>
					<!-- =============================added by xiaoxin ==================================== -->
					<form id="search_engine" class="standard_form" method="post" name="search_engine" action="../view/searchResult.php">
						<div id="search_input_wrap" class="show">
							<ul id="search_engine_class" class="">
								<li class="input_wrap">
								<table>
									<tbody>
										<tr>
											<td>
												<span class="translatable" lang="Search">搜索</span>
											</td>
											<td>
											
												<select id="search_engine_type" name="search_type">
													<option value="1">图书</option>
													<option value="2">小组</option>
													<option value="3">论文</option>
													<option value="4">用户</option>
												</select>
											</td>
											<td>
												<input id="search_engine_word" class="search_field text_input" type="text" maxlength="100" size="11" name="search">
											</td>
											<td>
												<!--提交-->
												<input type="submit" name="submit" value="Search" />
											</td>
											<!-- =============================added by xiaoxin ==================================== -->
										</tr>
									</tbody>
								</table>
								</li>
							</ul>
						</div>
					</form>
				</div>
			</div>
			<!-- end of 搜索框-->

			<div id="Tags">
				<span><input type="hidden" name="search_type" value="0"></span>
				<div id="bookTags">  <!--点击标签，对跳转到相应的分类界面-->
					<p>书籍标签...</p>
					<ol>
					<!--	<li>[文学]</li>-->
						<?php
						for($i = 0; $i < count($book_description_list) && $i < 3; $i++)
						{
						?>
							<li><a href="booklist.php?description=<?=$book_description_list[$i]?>"><?=$book_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
					<ol>
					<!--	<li>[流行]</li>-->
						<?php
						for($i = 3; $i < count($book_description_list) && $i < 6; $i++)
						{
						?>
							<li><a href="booklist.php?description=<?=$book_description_list[$i]?>"><?=$book_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
					<ol>
						<?php
						for($i = 6; $i < count($book_description_list) && $i < 9; $i++)
						{
						?>
							<li><a href="booklist.php?description=<?=$book_description_list[$i]?>"><?=$book_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
				</div>
				<div id="paperTags"><!-- 论文-->
					<p>论文标签...</p>
					<ol>
					<!--	<li>[文学]</li>-->
						<?php
						for($i = 0; $i < count($thesis_description_list) && $i < 3; $i++)
						{
						?>
							<li><a href="thesisList.php?description=<?=$thesis_description_list[$i]?>"><?=$thesis_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
					<ol>
					<!--	<li>[流行]</li>-->
						<?php
						for($i = 3; $i < count($thesis_description_list) && $i < 6; $i++)
						{
						?>
							<li><a href="thesisList.php?description=<?=$thesis_description_list[$i]?>"><?=$thesis_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
					<ol>
						<?php
						for($i = 6; $i < count($thesis_description_list) && $i < 9; $i++)
						{
						?>
							<li><a href="thesisList.php?description=<?=$thesis_description_list[$i]?>"><?=$thesis_description_list[$i]?></a></li>
						<?php
						}
						?>
					</ol>
				</div>
			</div>
			<!--end标签 -->
		</div>
		
		<div id="left"> 	
			<div id="latestbook">
				<p>最畅销书籍<a href="booklist.php">>></a></p>
				<a href="http://read.douban.com/?dcn=2012-shaonianpi&dcs=book&dcm=douban">
					<p><img src="../images/books/shaonianpi-onsale-book2.jpg" alt="No founded"/></p>
				</a>
			</div>
		
			<div id="books">
				<p>最新书籍<a href="bookList.php">>></a></p>
				<?php
				for($i = 0; $i < count($book_images); $i++)
				{
				?>
					<div class="book">
						<a href="bookPage.php?book_name=<?=$book_names[$i]?>" >
							<img src="<?=$book_images[$i]?>" />
						</a>
					</div>
				<?php
				}
				?>
				
				
			</div>
			<div id="papers">
				<div id="papersleft">
					<p>最新的论文<a href="thesisList.php">>></a></p>
					<?php
					for ($i = 0; $i < count($thesis_names)/2; $i++)
					{
					?>
						<p class="paper"><a href="thesisPage.php?thesis_name=<?=$thesis_names[$i]?>"><?=$thesis_names[$i]?></a></p>
					<?php
					}
					?>
				</div>
				<!--=============================== By xiaoxin ==================================-->
				<div id="papersright">
					<?php
					for ($i = 4; $i < count($thesis_names); $i++)
					{
					?>
						<p class="paper"><a href="thesisPage.php?thesis_name=<?=$thesisname?>"><?=$thesis_names[$i]?></a></p>
					<?php
					}
					?>
				</div>
				<!--=============================== End ==================================-->
			</div>
		</div>
		<!--end od left-->
	</div><!--end of conta -->
	
	<div id="groups">
		<p>最新话题小组<a href="groupList.php">>></a></p>
		<?php
		while($group = mysql_fetch_array($group_list))
		{
			$managerName = $group['ManagerName'];
		?>
			<div id="topic">
				<p><a href="groupPage.php?group_name=<?=$group['Groupname']?>"><?=$group['Groupname']?></a></p>
				<p>创建人：<?=$managerName?></p>
			</div>
		<?php
		}
		?>
	</div>
</body>
	